Add a file-set signal to the filechooser button. Bug 353196.
authorMariano Suárez-Alvarez <mariano@gnome.org>
Tue, 26 Dec 2006 22:20:06 +0000 (22:20 +0000)
committerMariano Suárez-Alvarez <mariano@src.gnome.org>
Tue, 26 Dec 2006 22:20:06 +0000 (22:20 +0000)
2006-12-26  Mariano Suárez-Alvarez  <mariano@gnome.org>

* gtk/gtkfilechooserbuuton.[hc]: Add a file-set signal to the
filechooser button. Bug 353196.

ChangeLog
gtk/gtkfilechooser.c
gtk/gtkfilechooserbutton.c
gtk/gtkfilechooserbutton.h

index f166c68d92f7acdacf38e6443d020b145958c7d6..5d9d29ce5083f69742069c7b63af6e64dc8882f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-26  Mariano Suárez-Alvarez  <mariano@gnome.org>
+
+       * gtk/gtkfilechooserbuuton.[hc]: Add a file-set signal to the
+       filechooser button. Bug 353196.
+
 2006-12-26  Kristian Rietveld  <kris@gtk.org>
 
        * gtk/gtktreeview.c (gtk_tree_view_search_init): fix typo causing
index 384a89bcef02976f9cfd2b3bd91b35cfb8ced098..68243520b99e847caf4fac0cb887961101a31a39 100644 (file)
@@ -140,7 +140,7 @@ gtk_file_chooser_class_init (gpointer g_iface)
    * gtk_file_chooser_get_preview_filename() or
    * gtk_file_chooser_get_preview_uri() to get the name of the file to preview.
    * Your widget may not be able to preview all kinds of files; your callback
-   * must call gtk_file_chooser_set_preview_wiget_active() to inform the file
+   * must call gtk_file_chooser_set_preview_widget_active() to inform the file
    * chooser about whether the preview was generated successfully or not.
    *
    * Please see the example code in <xref linkend="gtkfilechooser-preview"/>.
index 9c66da518aaac9de33431cfe1d28fab30072ba3a..e5c23d613ee311c18c83da3e03e2296d86b2b842 100644 (file)
@@ -48,6 +48,7 @@
 #include "gtkfilechooserdialog.h"
 #include "gtkfilechooserprivate.h"
 #include "gtkfilechooserutils.h"
+#include "gtkmarshalers.h"
 
 #include "gtkfilechooserbutton.h"
 
@@ -86,6 +87,13 @@ enum
   PROP_WIDTH_CHARS
 };
 
+/* Signals */
+enum
+{
+  FILE_SET,
+  LAST_SIGNAL
+};
+
 /* TreeModel Columns */
 enum
 {
@@ -301,6 +309,7 @@ static void     dialog_response_cb               (GtkDialog      *dialog,
                                                  gint            response,
                                                  gpointer        user_data);
 
+static guint file_chooser_button_signals[LAST_SIGNAL] = { 0 };
 
 /* ******************* *
  *  GType Declaration  *
@@ -342,6 +351,26 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
   widget_class->style_set = gtk_file_chooser_button_style_set;
   widget_class->screen_changed = gtk_file_chooser_button_screen_changed;
   widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate;
+  
+  /**
+   * GtkFileChooserButtons::file-set:
+   * @widget: the object which received the signal.
+   *
+   * The ::file-set signal is emitted when the user selects a file.
+   * 
+   * Note that this signal is only emitted when the <emphasis>user</emphasis>
+   * changes the file. 
+   *
+   * Since: 2.12
+   */
+  file_chooser_button_signals[FILE_SET] =
+    g_signal_new (I_("file-set"),
+                 G_TYPE_FROM_CLASS (gobject_class),
+                 G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                 G_STRUCT_OFFSET (GtkFileChooserButtonClass, file_set),
+                 NULL, NULL,
+                 _gtk_marshal_VOID__VOID,
+                 G_TYPE_NONE, 0);
 
   /**
    * GtkFileChooserButton:dialog:
@@ -2695,6 +2724,8 @@ dialog_response_cb (GtkDialog *dialog,
 
   gtk_widget_set_sensitive (priv->combo_box, TRUE);
   gtk_widget_hide (priv->dialog);
+
+  g_signal_emit_by_name (user_data, "file-set");
 }
 
 
index 8d896b4c19951e43a92eb55f6e0d9c3976c7beed..979c4b577e80ed383811425949d03666e478a2bb 100644 (file)
@@ -58,6 +58,8 @@ struct _GtkFileChooserButtonClass
   /*< private >*/
   GtkHBoxClass parent_class;
 
+  void (* file_set) (GtkFileChooserButton *fc);
+
   void (*__gtk_reserved1);
   void (*__gtk_reserved2);
   void (*__gtk_reserved3);
@@ -65,7 +67,6 @@ struct _GtkFileChooserButtonClass
   void (*__gtk_reserved5);
   void (*__gtk_reserved6);
   void (*__gtk_reserved7);
-  void (*__gtk_reserved8);
 };